<!DOCTYPE html>
<html>
<head>
	<title>个人中心</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="/layui/css/layui.css"  media="all">
	<link rel="stylesheet" type="text/css" href="css/front/personCenter.css">
	<script src="${ctxPath!}/jquery/jquery.min.js"></script>
	<script type="text/javascript" src="/layui/layui.js"></script>
	<script src='http://www.51baomu.cn/Scripts/common.js' type="text/javascript"></script>

</head>
<body>
	<% include("/templates/common/nav.html"){} %>

<div class="table" style="margin: auto; margin-top: 100px;">
		<form class="layui-form" id="userForm">
			<input type="hidden" name="id" value="${client.id!}"/>
			<input type="hidden" name="userId" value="${client.userId!}"/>
			<div class="column" style="margin-top: 50px;">
	    		<label class="label">用户名：</label>
      			<input type="text" name="username" lay-verify="required" autocomplete="off" class="input" value="${client.username!}">
	    	</div>

	    	<div class="column">
	    		<label class="label">邮箱：</label>
	    		<input type="text" name="email" lay-verify="email" autocomplete="off" class="input" value="${client.email!}">
	    	</div>

	    	<div class="column">
	    		<label class="label">预产期：</label>
	    		<input type="text" name="dueDate" id="dueDate" lay-verify="date" placeholder="yyyy-MM-dd" value='${client.dueDate,dateFormat="yyyy-MM-dd"}' autocomplete="off" class="input">
	    	</div>

	    	<div class="column">
	    		<label class="label">期望城市：</label>
	    		<input type="text" name="expectedCity" lay-verify="required" autocomplete="off" class="input" value="${client.expectedCity!}">
	    	</div>

	    	<div class="column" style="margin-top: 30px;">
	    		<button id="submit" class="button" lay-filter="demo1" lay-submit="">确认修改</button>
	    	</div>


		</form>
		
	</div>
	<script>
        layui.use(['form', 'layedit', 'laydate'], function(){
            var form = layui.form
                ,layer = layui.layer
                ,layedit = layui.layedit
                ,laydate = layui.laydate;

            //日期
            laydate.render({
                elem: '#dueDate'
            });

            //监听提交
            form.on('submit(demo1)', function(data) {
                layer.alert(JSON.stringify(data.field), {
                    title: '最终的提交信息'
                })
                $.ajax({
                    type:"POST",
                    url:"/sys/user/update",
                    data:$("#userForm").serialize(),
                    success:function (data) {
                        if (data.status == 200) {
                            layer.alert(data.msg, {
                                icon: 1,
                                skin: 'layer-ext-moon'
                            }, function () {
                                window.location.href = "/main.html";
                            });
                        } else {
                            layer.alert(data.msg, {
                                icon: 2,
                                skin: 'layer-ext-moon'
                            });
                        }
                    }
                })

//				$("#userForm").serialize(), function (data) {
//
//            });
                return false;

            });
        });
	</script>
</body>
</html>